from django.db import models

# Create your models here.
class BookInfo(models.Model):
    name=models.CharField(max_length=100,unique=True)
    pub_date=models.DateField(null=True)
    readcount=models.IntegerField(default=0)
    commentcount=models.IntegerField(default=0)
    is_delete=models.BooleanField(default=False)

    class Meta:
        db_table='book_info'

class PeopleInfo(models.Model):
    GENDER_CHOICES=(
        (1,'Male'),
        (2,'Female'),
    )

    name=models.CharField(max_length=100,unique=True)
    gender=models.SmallIntegerField(default=1,choices=GENDER_CHOICES)
    description=models.CharField(max_length=500,null=True)
    is_delete=models.BooleanField(default=False)

    book=models.ForeignKey(BookInfo,on_delete=models.CASCADE)

    class Meta:
        db_table='people_info'